// import request from "../utils/request"
import axios from 'axios';
import querystring from 'querystring';
export const getAllUser = (params?: object) =>
  axios({
    url: '/user',
    method: 'get',
    params,
  });

export const getAllDepartment = (params?: object) =>
  axios({
    url: '/dept',
    method: 'get',
    params,
  });

export const addUser = (data?: any) => {
  let qs = querystring.stringify(data);
  console.log(qs);

  return axios({
    url: '/user',
    method: 'post',
    data: qs,
  });
};

export const delUser = (userId: string) => axios.delete(`/user/${userId}`);
export const changeUser = (data: any) => {
  let qs = querystring.stringify(data);
  console.log(qs);

  return axios({
    url: '/user',
    method: 'put',
    data: qs,
  });
};
